package Strategy;

/**
 * 策略模式
 *
 * @author liuyang
 * @since 2022/6/25 16:27
 */

public class CashStrategy{
    private Strategy strategy;

    public CashStrategy(String[] args) {
        switch (args[0]) {
            case "rebate":
                strategy = new GetCashRebate(args[1]);
                break;
            case "return":
                strategy = new GetCashReturn(args[1], args[2]);
                break;
            default:
                strategy = new GetCash();
        }
    }

    public String acceptCash(String money) {
        return strategy.payMoney(money);
    }
}
